{include file="public/head"/}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">添加友链</div>
                <div class="layui-card-body" pad15>
                    <div class="layui-form" wid100 lay-filter="">

                        <div class="layui-form-item">
                            <label class="layui-form-label">友链名称</label>
                            <div class="layui-input-inline">
                                <input type="text" name="title" lay-verify="required" placeholder="请输入友链名称" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">友链URL</label>
                            <div class="layui-input-inline">
                                <input type="text" name="link" lay-verify="link" placeholder="请输入友链URL" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('status')}</label>
                            <div class="layui-input-block">
                                <input type="radio" name="status" checked value="1" title="启用">
                                <input type="radio" name="status" value="0" title="禁用">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('order')}</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sort" placeholder="从小到大排序" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="add-but">确认保存</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/foot"/}
<script>
    layui.config({
        base: '__LAYDMIN__',{if config('app.app_debug')}version: true{/if}
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form'],function(){
		var $ = layui.$, admin = layui.admin, table = layui.table, element = layui.element, form = layui.form;	
		//添加提交
		form.on('submit(add-but)', function(data){
			admin.req({
				url: '{:url(SYS_PATH."/".CONTROLLER."/add")}' //实际使用请改成服务端真实接口
				, type: 'post'
				, data: data.field
				, done: function (res) {
					layer.msg(res.msg, {icon: 1, time: 1000}, function () {
						layer.closeAll("iframe");
						//刷新父页面
						parent.location.reload();
					});
				}
			});
		});
		
	});
</script>
</body>
</html>